﻿using MiniAspNetCore;
using System;
using System.Text;

namespace UseMiniAspNetCore
{
    class Program
    {
        static void Main(string[] args)
        {
            var webhost=new WebHostBuilder()
                            .UseServer(new HttpListenerServer("http://localhost:6000/"))
                            .Config(app =>
                            {
                                app.Use(next => async c =>
                                {
                                    string res = "hello world";
                                    byte[] buffer=Encoding.UTF8.GetBytes(res);
                                    await c.Response.Body.WriteAsync(buffer, 0, buffer.Length);
                                });
                            }).Build();

            webhost.StartAsync();
            Console.ReadKey();
        }
    }
}
